<template>
    <Button @click="btnClick">
        <slot></slot>
    </Button>
</template>
<script setup lang="ts">
import { Button } from 'vant'
import { useAttrs } from 'vue';

defineOptions({ name: 'VanButton' })
const attrs: any = useAttrs()

let preventClick = false

const btnClick = (e) => {
    if (attrs.onAsync) {
        if (preventClick) {
            return
        }
        preventClick = true
        attrs.onAsync(() => {
            setTimeout(() => {
                preventClick = false
            }, 300)
        })
    }
    if (attrs.onClick) {
        attrs.onClick(e)
    }
}



console.log('attrs', attrs);

</script>